combobox: Fix reentrancy in gtk_combo_box_popdown()
authorCarlos Garnacho <carlosg@gnome.org>
Thu, 5 Jun 2014 19:09:46 +0000 (21:09 +0200)
committerCarlos Garnacho <carlosg@gnome.org>
Thu, 5 Jun 2014 19:16:05 +0000 (21:16 +0200)
If called when already popped down, warnings would be issued due
to priv->grab_pointer being unexpectedly NULL, this would happen
in regular operation when selecting items in appears-as-list mode.

So both add a NULL check for priv->grab_pointer, and bail out early
if the popup window is already hidden.

gtk/gtkcombobox.c

index 240488655775b71cfecdce19ed1230c5d1fcfbe1..fd6e9224aabe31c65caa92ef82e7ead4422d8bbb 100644 (file)
@@ -2546,9 +2546,13 @@ gtk_combo_box_popdown (GtkComboBox *combo_box)
   if (!gtk_widget_get_realized (GTK_WIDGET (combo_box)))
     return;
 
+  if (!gtk_widget_is_drawable (priv->popup_window))
+    return;
+
   if (priv->grab_keyboard)
     gdk_device_ungrab (priv->grab_keyboard, GDK_CURRENT_TIME);
-  gdk_device_ungrab (priv->grab_pointer, GDK_CURRENT_TIME);
+  if (priv->grab_pointer)
+    gdk_device_ungrab (priv->grab_pointer, GDK_CURRENT_TIME);
 
   gtk_widget_hide (priv->popup_window);
   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->button),